﻿using System;
using System.Collections.Generic;
using System.Xml.Linq;
using DVK.SP2007;

namespace DVK.SP2007.UniversalClient
{
    /// <summary>
    /// Encapsulates Dvk Message with all the members.
    /// </summary>
    public class DvkMessage : IDvkMessage
    {
        /// <summary>
        /// Gets or sets the message id.
        /// </summary>
        /// <value>The id.</value>
        public int Id { get; set; }
        /// <summary>
        /// Gets or sets the unit id.
        /// </summary>
        /// <value>The unit id.</value>
        public int? UnitId { get; set; }
        /// <summary>
        /// Gets or sets the DHL id.
        /// </summary>
        /// <value>The DHL id.</value>
        public int? DhlId { get; set; }
        /// <summary>
        /// Gets or sets the local item id.
        /// </summary>
        /// <value>The local item id.</value>
        public int? LocalItemId { get; set; }
        /// <summary>
        /// Gets or sets the sending status.
        /// </summary>
        /// <value>The sending status.</value>
        public DvkSendingStatus SendingStatus { get; set; }
        /// <summary>
        /// Gets or sets the recipient status.
        /// </summary>
        /// <value>The recipient status.</value>
        public DvkRecipientStatus RecipientStatus { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether [status update needed].
        /// </summary>
        /// <value><c>true</c> if [status update needed]; otherwise, <c>false</c>.</value>
        public bool StatusUpdateNeeded { get; set; }

        /// <summary>
        /// Gets or sets the name of the folder.
        /// </summary>
        /// <value>The name of the folder.</value>
        public string FolderName { get; set; }
        /// <summary>
        /// Gets or sets the Dvk message data XML.
        /// </summary>
        /// <value>The data XML.</value>
        public DvkXml DataXml { get; set; }
        /// <summary>
        /// Gets or sets the title.
        /// </summary>
        /// <value>The title.</value>
        public string Title { get; set; }
        /// <summary>
        /// Gets or sets the name of the case.
        /// </summary>
        /// <value>The name of the case.</value>
        public string CaseName { get; set; }
        /// <summary>
        /// Gets or sets the custom xml sent with the Dvk message.
        /// </summary>
        /// <value>The meta XML.</value>
        public XElement MetaXml { get; set; }
        /// <summary>
        /// Gets or sets the sending date.
        /// </summary>
        /// <value>The sending date.</value>
        public DateTime? SendingDate { get; set; }
        /// <summary>
        /// Gets or sets the received date.
        /// </summary>
        /// <value>The received date.</value>
        public DateTime? ReceivedDate { get; set; }

        private SenderReceiverInfo _recipient;
        /// <summary>
        /// Gets or sets the recipient information.
        /// </summary>
        /// <value>The recipient.</value>
        public SenderReceiverInfo Recipient {
            get
            {
                if (_recipient == null)
                    _recipient = new SenderReceiverInfo();
                return _recipient;
            }
            set
            {
                _recipient = value;
            }
        }
        private SenderReceiverInfo _sender;
        /// <summary>
        /// Gets or sets the sender information.
        /// </summary>
        /// <value>The sender.</value>
        public SenderReceiverInfo Sender 
        {
            get
            {
                if (_sender == null)
                    _sender = new SenderReceiverInfo();
                return _sender;
            }
            set
            {
                _sender = value;
            }
        }
        /// <summary>
        /// Gets or sets the dvk fault.
        /// </summary>
        /// <value>The fault.</value>
        public DvkFault Fault { get; set; }
        public bool IsIncoming { get; set; }

    }
}